package com.jeomo.mem.provider.web;

import com.jeomo.common.core.dto.PageQueryDto;
import com.jeomo.common.core.dto.PageResponseDto;
import com.jeomo.common.core.request.PageRequest;
import com.jeomo.common.core.result.CommonResult;
import com.jeomo.common.core.util.BeanCopyUtil;
import com.jeomo.common.core.vo.PageResponseVo;
import com.jeomo.mem.provider.vo.MemberPointsDetailVo;
import com.jeomo.mem.starter.service.IMemPointsDetailService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 会员积分明细
 *
 * @author:Jackpot
 * @create 2020-10-30 15:25
 * @description:
 */
@RestController
@RequestMapping("/member/points")
public class MemPointsDetailController {

    @Resource
    private IMemPointsDetailService memPointsDetailService;


    @ApiOperation("分页获取会员积分明细")
    @PostMapping("/details")
    public CommonResult<PageResponseVo<MemberPointsDetailVo>> getPointRulesByPage(@RequestBody PageRequest pageRequest){
        PageQueryDto dto = BeanCopyUtil.copyProperties(pageRequest, PageQueryDto.class);
        PageResponseDto pageResponseDto = memPointsDetailService.pageSearch(dto);
        PageResponseVo<MemberPointsDetailVo> memPointsRulePageResVo = BeanCopyUtil.copyPageProperties(pageResponseDto, MemberPointsDetailVo.class);
        return CommonResult.success(memPointsRulePageResVo);
    }

}
